class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users, :options => 'ENGINE=InnoDB DEFAULT CHARSET=UTF8' do |t|
      t.column "username", :string, :null => false
      t.column "password_salt", :string, :null => false
      t.column "password_hash", :string, :null => false
            
      t.column "email", :string, :null => false
    end
    
    foreign_key(:identities, :user_id, :users)
    
    User.create(:username => "gigix", :password => "password", :email => "gigix1980@gmail.com")
    User.create(:username => "exceedhl", :password => "password", :email => "exceedhl@gmail.com")
  end
  
  def self.down
    remove_foreign_key(:identities, :user_id)
    drop_table :users
  end
end
